import fetch from 'src/fetch'
import * as shopUrl from '../constant/shop'

export const list = (params) => {
  return fetch({
    url: shopUrl.url,
    params
  })
}

export const enable = (no) => {
  return fetch({
    url: shopUrl.url + '/' + no,
    method: 'put'
  })
}

export const companyBill = (params) => {
  return fetch({
    url: '/api/companyBill',
    params
  })
}

export const getCompanyUserInfo = (params) => {
  return fetch({
    url: '/api/companyUser/getCompanyUserInfo',
    params
  })
}

export const updateShopInfo = (data) => {
  return fetch({
    url: '/api/companyUser/UpdateShopInfo',
    method: 'put',
    data
  })
}

export const getAllShopTypes = (params) => {
  return fetch({
    url: '/api/companyUser/allShopTypes',
    params
  })
}

export const getNoPayBills = (shopId) => {
  return fetch({
    url: '/api/companyBill/' + shopId + '/noPayBills'
  })
}

export const form = (data) => {
  return fetch({
    url: '/api/companyBill',
    method: 'post',
    data
  })
}

export const upload = (data) => {
  return fetch({
    url: `/api/companyBill/${data.shopId}/upload`,
    method: 'post',
    data
  })
}

export const confirm = (billId) => {
  return fetch({
    url: '/api/companyBill/' + billId,
    method: 'put',
  })
}

export const del = (billId) => {
  return fetch({
    url: '/api/companyBill/' + billId,
    method: 'delete',
  })
}

export const page = (data) => {
  return fetch({
    url: shopUrl.page,
    method: 'post',
    data
  })
}

export const examine = (params) => {
  return fetch({
    url: shopUrl.examine,
    params
  })
}

export const reset = (params) => {
  return fetch({
    url: shopUrl.reset,
    params
  })
}

export const coupons = (params) => {
  return fetch({
    url: '/api/coupons/allCoupons',
    params
  })
}

export const couponsPut = (couponNumber) => {
  return fetch({
    url: '/api/coupons/' + couponNumber,
    method: 'put'
  })
}